<?php
$model = new BDynamicFormModel();
$parentRoleField = 'media_parentRoleId_manage_role';
$model->addField($parentRoleField);
$adminRoleData = array();
$memberRoleData = array();
$customerRoleData = array();
if(isset($spaceRoleData)){
    if(isset($spaceRoleData['adminRoles']))
        $adminRoleData = $spaceRoleData['adminRoles'];
    if(isset($spaceRoleData['memberRoles']))
        $memberRoleData = $spaceRoleData['memberRoles'];
    if(isset($spaceRoleData['customerRoles']))
        $customerRoleData = $spaceRoleData['customerRoles'];
}
?>
<?php
$form = $this->beginWidget('CActiveForm', array(
    "id" => "manage-myInfo-form",
    'enableAjaxValidation' => FALSE,
    'htmlOptions' => array('class' => 'form-signin', 'role' => 'form'),
        ));
?>
<div class="container">
    <BR>
    <legend>管理机构角色</legend>
    <?php if (isset($addRoleResult)) { ?>
        <?php
        if ($addRoleResult == 'success') {
            echo '<p class="bg-success">add child role successfully!</p>';
        } else {
            echo '<p class="bg-danger">add child role fail!</p>';
        }
        ?>
    <?php } ?>

    <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
        <div class="panel panel-default">
            <div class="panel-heading" role="tab" id="headingOne">
                <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                        管理员权限
                    </a>
                </h4>
            </div>
            <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
                <div class="panel-body">
                    <?php
                    echo CHtml::activeRadioButtonList($model, $parentRoleField, $adminRoleData);
                    ?>
                </div>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading" role="tab" id="headingTwo">
                <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo">
                        工作成员权限
                    </a>
                </h4>
            </div>
            <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
                <div class="panel-body">
                    <?php
                    echo CHtml::activeRadioButtonList($model, $parentRoleField, $memberRoleData);
                    ?>
                </div>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading" role="tab" id="headingThree">
                <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="true" aria-controls="collapseThree">
                        客户权限
                    </a>
                </h4>
            </div>
            <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
                <div class="panel-body">
                    <?php
                    echo CHtml::activeRadioButtonList($model, $parentRoleField, $customerRoleData);
                    ?>
                </div>
            </div>
        </div>
    </div>
    <div class="submit"> 
        <?php
        echo $control->getAjaxLink(
                array('name' => '添加子权限', 'id' => BUIRole::Add_Child_Role), array(
            'htmlOptions' => array(
                'class' => 'btn btn-info btn-block')));
        ?>
        <?php
        echo $control->getAjaxLink(
                array('name' => '删除子权限', 'id' => BUIRole::Delete_Child_Role), array(
            'htmlOptions' => array(
                'class' => 'btn btn-sucess btn-block')));
        ?>
    </div>
</div>
<?php $this->endWidget(); ?>